import user.UsersDAO;
import user.UsersImpl;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 查找数据库所有用户测试
 * @author 彬彬
 */
public class SqlFineAll {
    public static void main(String[] args) {
        UsersDAO usersDAO = new UsersImpl();
        ResultSet rs =  usersDAO.findAll();
        System.out.println(rs);
        while(true){
            try {
                if (!rs.next()) break;
                int id = rs.getInt("id");
                String username = rs.getString("name");
                String userpass = rs.getString("password");
                String phone = rs.getString("phone");
                System.out.println("id: " + id + "\tname: "+ username + "\tpass: "+ userpass + "\tphone: "+phone+"\n");
            }catch(SQLException e){
                e.printStackTrace();
            }
        }
    }
}
